# 导入selenium

from selenium import webdriver

DRIVER_PATH = './chromedriver.exe'
BROWSER = webdriver.Chrome(DRIVER_PATH)
TARGET_URL = 'https://www.baidu.com/'
BROWSER.get(TARGET_URL)

content = BROWSER.page_source
# print(content)

# 元素定位
# <selenium.webdriver.remote.webelement.WebElement
# (session="04d5c2fd89aa5fdf0c7bb0b44fada288", element="ee1a6a84-976e-4f44-b1b5-927406fe4211")>
button = BROWSER.find_element_by_id('su')
print(button)

# 属性获取
print(button.get_attribute('class'))
# 文本内容获取
print(button.text)
# 获取标签名
print(button.tag_name)

